﻿using MediatR;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Traceability.App.API.Application.Command.Enterprise;
using Traceability.App.API.DTOs;
using Traceability.App.ErrorCode;

namespace Traceability.App.API.Controllers
{
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class EnterpriseController : ControllerBase
    {
        private readonly IMediator mediator;

        public EnterpriseController(IMediator mediator)
        {
            this.mediator = mediator;
        }
        /// <summary>
        /// 设置养殖企业基本信息
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpPost]
        public Task<APIResult<int>> CreateYZEnterprise(CreateYZEnterpriseCommand request)
        {
            return mediator.Send(request);
        }
        /// <summary>
        /// 设置养殖企业基本信息2
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpPost]
        public Task<APIResult<int>> UpdYZEnterprise(UpdYZEnterpriseCommand request)
        {
            return mediator.Send(request);
        }
        /// <summary>
        /// 获取养殖企业基本信息
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpGet]
        public Task<APIResult<YZEnterpriseDTO>> GetYZEnterprise([FromQuery] GetYZEnterpriseCommand request)
        {
            return mediator.Send(request);
        }
        /// <summary>
        /// 设置屠宰企业基本信息
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpPost]
        public Task<APIResult<int>> CreateTZEnterprise(CreateTZEnterpriseCommand request)
        {
            return mediator.Send(request);
        }
        /// <summary>
        /// 设置屠宰企业基本信息2
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpPost]
        public Task<APIResult<int>> UpdTZEnterprise(UpdTZEnterpriseCommand request)
        {
            return mediator.Send(request);
        }
        /// <summary>
        /// 获取屠宰企业基本信息
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpGet]
        public Task<APIResult<TZEnterpriseDTO>> GetTZEnterprise([FromQuery]GetTZEnterpriseCommand request)
        {
            return mediator.Send(request);
        }
        /// <summary>
        /// 设置深加工企业基本信息
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpPost]
        public Task<APIResult<int>> CreateSJGEnterprise(CreateSJGEnterpriseCommand request)
        {
            return mediator.Send(request);
        }
        /// <summary>
        /// 设置深加工企业基本信息2
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpPost]
        public Task<APIResult<int>> UpdSJGEnterprise(UpdSJGEnterpriseCommand request)
        {
            return mediator.Send(request);
        }
        /// <summary>
        /// 获取深加工企业基本信息
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpGet]
        public Task<APIResult<SJGEnterpriseDTO>> GetSJGEnterprise([FromQuery]GetSJGEnterpriseCommand request)
        {
            return mediator.Send(request);
        }
    }
}
